Skip to content

Conversation

@ByteZhang1024
Copy link
Contributor

@ByteZhang1024 ByteZhang1024 commented Apr 9, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive Bluetooth utility library with native support for checking Bluetooth state and managing device connections.
    • Launched an example React Native app demonstrating Bluetooth scanning and connection management.
  • Documentation

    • Added detailed guides including README, CONTRIBUTING, and Code of Conduct.
    • Rolled out structured templates for bug reports and feedback submission.
  • Chores

    • Implemented extensive configuration and automation workflows to ensure consistent coding styles, dependency management, testing, and package publishing.

@coderabbitai
Copy link

coderabbitai bot commented Apr 9, 2025

Walkthrough

This pull request introduces a comprehensive set of new configuration, documentation, and build files to support the React Native BLE utilities library and its example app. It adds GitHub workflows, linting, publishing actions, and project standards. Additionally, it provides complete Android and iOS native project setups, integrates native Bluetooth functionalities (both in Objective‑C and Swift), and defines TypeScript configuration and library source code for BLE operations.

Changes

File(s) Change Summary
.editorconfig, .gitattributes, .gitignore, .nvmrc, .watchmanconfig, .yarnrc.yml Added project-wide configurations for coding style, Git attributes, ignored files, Node version, file watching, and Yarn setup.
.github/ISSUE_TEMPLATE/*, .github/actions/setup/action.yml, .github/workflows/{lint.yml,package-publish.yml} Introduced GitHub issue templates and workflows for linting, testing, and npm package publishing.
CODE_OF_CONDUCT.md, CONTRIBUTING.md, README.md Added documentation outlining community guidelines, contribution instructions, and library usage.
android/{build.gradle,gradle.properties,gradle-wrapper.properties,gradlew,gradlew.bat,src/main/AndroidManifest{.xml,New.xml}} Provided Android build scripts, properties, executables, and manifest files for library module configuration.
babel.config.js Configured Babel preset for React Native.
example/{.bundle/config, .watchmanconfig, Gemfile, README.md, app.json, babel.config.js, index.js, jest.config.js, metro.config.js, package.json, react-native.config.js} Set up example project configurations, documentation, and build/test scripts.
example/android/app/{build.gradle,proguard-rules.pro,src/**} Added Android app project files, including build scripts, multiple manifest files, activity classes, and resource definitions.
example/ios/{BleUtilsExample.xcodeproj/**, BleUtilsExample.xcworkspace/**, AppDelegate.swift, Podfile, .xcode.env, LaunchScreen.storyboard, Info.plist, ...} Provided iOS app project files, configurations, resources, and workspace settings for the example app.
ios/{BleUtils-Bridging-Header.h, BleUtils.mm, BleUtils.swift, Helper.swift} Implemented BLE utilities in native code with bridging headers, Objective‑C and Swift modules, and helper functions.
lefthook.yml, root package.json (for @onekeyfe/react-native-ble-utils) Set up repository hooks and library package configurations with scripts for development, testing, and release.
src/{index.ts, type.ts}, tsconfig.json, tsconfig.build.json, turbo.json Defined the BLE utility class, TypeScript types, and build configurations for the library module.

Sequence Diagram(s)

sequenceDiagram
  participant U as User/App
  participant JS as BleUtils (JS)
  participant NM as Native Module
  U->>JS: Call checkState()
  JS->>NM: Invoke native checkState method
  NM-->>JS: Return Bluetooth state
  JS-->>U: Resolve promise with state
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or Summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@socket-security
Copy link

Report too large to display inline

View full report↗︎

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 44

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4cf8777 and 5586510.

⛔ Files ignored due to path filters (19)
  • .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs is excluded by !**/.yarn/**
  • .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs is excluded by !**/.yarn/**
  • .yarn/releases/yarn-3.6.1.cjs is excluded by !**/.yarn/**
  • android/gradle/wrapper/gradle-wrapper.jar is excluded by !**/*.jar
  • example/Gemfile.lock is excluded by !**/*.lock
  • example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png is excluded by !**/*.png
  • example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png is excluded by !**/*.png
  • example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png is excluded by !**/*.png
  • example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png is excluded by !**/*.png
  • example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png is excluded by !**/*.png
  • example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png is excluded by !**/*.png
  • example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png is excluded by !**/*.png
  • example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png is excluded by !**/*.png
  • example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png is excluded by !**/*.png
  • example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png is excluded by !**/*.png
  • example/android/gradle/wrapper/gradle-wrapper.jar is excluded by !**/*.jar
  • example/ios/Podfile.lock is excluded by !**/*.lock
  • src/__tests__/index.test.tsx is excluded by !src/**/*.{test,spec}.{js,jsx,ts,tsx}
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (72)
  • .editorconfig (1 hunks)
  • .gitattributes (1 hunks)
  • .github/ISSUE_TEMPLATE/bug_report.yml (1 hunks)
  • .github/ISSUE_TEMPLATE/config.yml (1 hunks)
  • .github/actions/setup/action.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • .github/workflows/package-publish.yml (1 hunks)
  • .gitignore (1 hunks)
  • .nvmrc (1 hunks)
  • .watchmanconfig (1 hunks)
  • .yarnrc.yml (1 hunks)
  • BleUtils.podspec (1 hunks)
  • CODE_OF_CONDUCT.md (1 hunks)
  • CONTRIBUTING.md (1 hunks)
  • README.md (1 hunks)
  • android/build.gradle (1 hunks)
  • android/gradle.properties (1 hunks)
  • android/gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • android/gradlew (1 hunks)
  • android/gradlew.bat (1 hunks)
  • android/src/main/AndroidManifest.xml (1 hunks)
  • android/src/main/AndroidManifestNew.xml (1 hunks)
  • babel.config.js (1 hunks)
  • example/.bundle/config (1 hunks)
  • example/.watchmanconfig (1 hunks)
  • example/Gemfile (1 hunks)
  • example/README.md (1 hunks)
  • example/android/app/build.gradle (1 hunks)
  • example/android/app/proguard-rules.pro (1 hunks)
  • example/android/app/src/debug/AndroidManifest.xml (1 hunks)
  • example/android/app/src/main/AndroidManifest.xml (1 hunks)
  • example/android/app/src/main/java/bleutils/example/MainActivity.kt (1 hunks)
  • example/android/app/src/main/java/bleutils/example/MainApplication.kt (1 hunks)
  • example/android/app/src/main/res/drawable/rn_edit_text_material.xml (1 hunks)
  • example/android/app/src/main/res/values/strings.xml (1 hunks)
  • example/android/app/src/main/res/values/styles.xml (1 hunks)
  • example/android/build.gradle (1 hunks)
  • example/android/gradle.properties (1 hunks)
  • example/android/gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • example/android/gradlew (1 hunks)
  • example/android/gradlew.bat (1 hunks)
  • example/android/settings.gradle (1 hunks)
  • example/app.json (1 hunks)
  • example/babel.config.js (1 hunks)
  • example/index.js (1 hunks)
  • example/ios/.xcode.env (1 hunks)
  • example/ios/BleUtilsExample.xcodeproj/project.pbxproj (1 hunks)
  • example/ios/BleUtilsExample.xcodeproj/xcshareddata/xcschemes/BleUtilsExample.xcscheme (1 hunks)
  • example/ios/BleUtilsExample.xcworkspace/contents.xcworkspacedata (1 hunks)
  • example/ios/BleUtilsExample/AppDelegate.swift (1 hunks)
  • example/ios/BleUtilsExample/Images.xcassets/AppIcon.appiconset/Contents.json (1 hunks)
  • example/ios/BleUtilsExample/Images.xcassets/Contents.json (1 hunks)
  • example/ios/BleUtilsExample/Info.plist (1 hunks)
  • example/ios/BleUtilsExample/LaunchScreen.storyboard (1 hunks)
  • example/ios/BleUtilsExample/PrivacyInfo.xcprivacy (1 hunks)
  • example/ios/Podfile (1 hunks)
  • example/jest.config.js (1 hunks)
  • example/metro.config.js (1 hunks)
  • example/package.json (1 hunks)
  • example/react-native.config.js (1 hunks)
  • example/src/App.tsx (1 hunks)
  • ios/BleUtils-Bridging-Header.h (1 hunks)
  • ios/BleUtils.mm (1 hunks)
  • ios/BleUtils.swift (1 hunks)
  • ios/Helper.swift (1 hunks)
  • lefthook.yml (1 hunks)
  • package.json (1 hunks)
  • src/index.ts (1 hunks)
  • src/type.ts (1 hunks)
  • tsconfig.build.json (1 hunks)
  • tsconfig.json (1 hunks)
  • turbo.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (7)
example/babel.config.js (2)
example/metro.config.js (5)
  • path (1-1)
  • require (2-2)
  • require (3-3)
  • pkg (4-4)
  • root (6-6)
example/react-native.config.js (2)
  • path (1-1)
  • pkg (2-2)
example/metro.config.js (2)
example/babel.config.js (4)
  • path (1-1)
  • require (2-2)
  • pkg (3-3)
  • root (5-5)
example/react-native.config.js (2)
  • path (1-1)
  • pkg (2-2)
example/react-native.config.js (2)
example/babel.config.js (3)
  • path (1-1)
  • require (2-2)
  • pkg (3-3)
example/metro.config.js (4)
  • path (1-1)
  • require (2-2)
  • require (3-3)
  • pkg (4-4)
example/index.js (1)
example/src/App.tsx (1)
  • App (12-128)
src/type.ts (1)
src/index.ts (4)
  • BleState (85-85)
  • Peripheral (85-85)
  • AdvertisingData (85-85)
  • BondState (85-85)
ios/BleUtils.swift (3)
src/index.ts (3)
  • checkState (14-20)
  • getConnectedPeripherals (27-44)
  • Peripheral (85-85)
ios/Helper.swift (2)
  • centralManagerStateToString (5-22)
  • advertisingInfo (63-73)
src/type.ts (1)
  • Peripheral (31-36)
src/index.ts (1)
src/type.ts (1)
  • Peripheral (31-36)
🪛 Biome (1.9.4)
example/babel.config.js

[error] 1-1: A Node.js builtin module should be imported with the node: protocol.

Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.

(lint/style/useNodejsImportProtocol)

example/metro.config.js

[error] 1-1: A Node.js builtin module should be imported with the node: protocol.

Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.

(lint/style/useNodejsImportProtocol)

example/react-native.config.js

[error] 1-1: A Node.js builtin module should be imported with the node: protocol.

Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.

(lint/style/useNodejsImportProtocol)

🪛 markdownlint-cli2 (0.17.2)
README.md

13-13: Multiple consecutive blank lines
Expected: 1; Actual: 2

(MD012, no-multiple-blanks)


22-22: Multiple consecutive blank lines
Expected: 1; Actual: 2

(MD012, no-multiple-blanks)

example/README.md

1-1: First line in a file should be a top-level heading
null

(MD041, first-line-heading, first-line-h1)


73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


74-74: Inline HTML
Element: kbd

(MD033, no-inline-html)

🪛 GitHub Check: lint
example/src/App.tsx

[warning] 104-104:
'device' is already declared in the upper scope on line 91 column 17


[warning] 117-117:
'device' is already declared in the upper scope on line 91 column 17

🪛 RuboCop (1.73)
example/ios/Podfile

[convention] 6-6: Put a comma after the last item of a multiline array.

(Style/TrailingCommaInArrayLiteral)


[convention] 31-31: Avoid comma after the last parameter of a method call.

(Style/TrailingCommaInArguments)

BleUtils.podspec

[convention] 15-15: Prefer to_s over string interpolation.

(Style/RedundantInterpolation)

example/Gemfile

[convention] 8-8: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem activesupport should appear before cocoapods.

(Bundler/OrderedGems)


[convention] 10-10: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem concurrent-ruby should appear before xcodeproj.

(Bundler/OrderedGems)

🪛 LanguageTool
CODE_OF_CONDUCT.md

[style] ~33-~33: Try using a synonym here to strengthen your wording.
Context: ...ind * Trolling, insulting or derogatory comments, and personal or political attacks * Pu...

(COMMENT_REMARK)

example/README.md

[uncategorized] ~78-~78: Loose punctuation mark.
Context: ...run and modified your React Native App. 🥳 ### Now what? - If you ...

(UNLIKELY_OPENING_PUNCTUATION)


[style] ~82-~82: Consider using a more polite wording.
Context: ...partying_face: ### Now what? - If you want to add this new React Native code to an...

(IF_YOU_WANT)


[uncategorized] ~94-~94: Possible missing preposition found.
Context: ...an overview of React Native and how setup your environment. - [Learn the Basics](...

(AI_HYDRA_LEO_MISSING_TO)

CONTRIBUTING.md

[style] ~26-~26: Consider using a more polite wording.
Context: ...e a rebuild of the example app. If you want to use Android Studio or XCode to edit ...

(IF_YOU_WANT)


[uncategorized] ~73-~73: Loose punctuation mark.
Context: ...rg/en) for our commit messages: - fix: bug fixes, e.g. fix crash due to deprec...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~74-~74: Loose punctuation mark.
Context: ...crash due to deprecated method. - feat: new features, e.g. add new method to th...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~75-~75: Loose punctuation mark.
Context: ...d new method to the module. - refactor: code refactor, e.g. migrate from class ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~76-~76: Loose punctuation mark.
Context: ...from class components to hooks. - docs: changes into documentation, e.g. add us...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~76-~76: The preposition “to” seems more likely in this position than the preposition “into”.
Context: ... components to hooks. - docs: changes into documentation, e.g. add usage example f...

(AI_EN_LECTOR_REPLACEMENT_PREPOSITION_INTO_TO)


[uncategorized] ~76-~76: This verb may not be in the correct form. Consider using a different form for this context.
Context: ...docs: changes into documentation, e.g. add usage example for the module.. - test`...

(AI_EN_LECTOR_REPLACEMENT_VERB_FORM)


[typographical] ~76-~76: Two consecutive dots
Context: ...n, e.g. add usage example for the module.. - test: adding or updating tests, e.g...

(DOUBLE_PUNCTUATION)


[uncategorized] ~77-~77: Loose punctuation mark.
Context: ... usage example for the module.. - test: adding or updating tests, e.g. add inte...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~78-~78: Loose punctuation mark.
Context: ...integration tests using detox. - chore: tooling changes, e.g. change CI config....

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~104-~104: Loose punctuation mark.
Context: ...ious scripts for common tasks: - yarn: setup project by installing dependencie...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~105-~105: Loose punctuation mark.
Context: ...talling dependencies. - yarn typecheck: type-check files with TypeScript. - `ya...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~106-~106: Loose punctuation mark.
Context: ...eck files with TypeScript. - yarn lint: lint files with ESLint. - yarn test: ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~107-~107: Loose punctuation mark.
Context: ...: lint files with ESLint. - yarn test: run unit tests with Jest. - yarn examp...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~108-~108: Loose punctuation mark.
Context: ... tests with Jest. - yarn example start: start the Metro server for the example ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~109-~109: Loose punctuation mark.
Context: ...he example app. - yarn example android: run the example app on Android. - `yarn...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~110-~110: Loose punctuation mark.
Context: ...ple app on Android. - yarn example ios: run the example app on iOS. ### Sendin...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~114-~114: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...free series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead....

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🪛 YAMLlint (1.35.1)
.github/ISSUE_TEMPLATE/bug_report.yml

[error] 64-64: trailing spaces

(trailing-spaces)

🪛 SwiftLint (0.57.0)
ios/Helper.swift

[Warning] 63-63: Shorthand syntactic sugar should be used, i.e. [String: Int] instead of Dictionary<String, Int>

(syntactic_sugar)

🔇 Additional comments (101)
.nvmrc (1)

1-1: Node.js Version Set.
The file clearly specifies Node.js version "v20". This is concise and meets the project's environment needs.

example/app.json (1)

1-5: Valid App Manifest JSON.
The JSON structure is simple and correct. Both "name" and "displayName" are set to "BleUtilsExample". Verify that this naming aligns with your branding and app registration requirements.

example/jest.config.js (1)

1-4: Standard Jest Configuration.
The preset is correctly set to "react-native", which will ensure proper testing for your React Native app.

babel.config.js (1)

1-4: Appropriate Babel Configuration.
The Babel preset "module:react-native-builder-bob/babel-preset" is properly used, aligning with standard React Native setups.

android/src/main/AndroidManifestNew.xml (1)

1-3:

Details

❓ Verification inconclusive

Minimal Android Manifest Detected.
The manifest includes the essential Android XML namespace. Consider adding a package attribute or additional metadata if this file will serve as the main or merged manifest. Also, verify its interaction with the existing AndroidManifest.xml in the project.


Action: Verify Manifest Completeness

The Android manifest in android/src/main/AndroidManifestNew.xml is very minimal. It currently includes only the essential Android XML namespace and no package attribute or additional metadata. If this file is meant to serve as the main or merged manifest, please add a package attribute and the necessary metadata. Also, verify its interaction with the existing AndroidManifest.xml to prevent merge conflicts.

  • File: android/src/main/AndroidManifestNew.xml
  • Suggested: Add a package attribute and additional metadata if it serves as the main manifest.
  • Reminder: Check how this file interacts with the project’s primary AndroidManifest.xml.
.gitattributes (1)

1-3: Clear Git Attributes Configuration

The file sets up Git attributes neatly. Marking *.pbxproj as binary and defining CRLF for *.bat provides precise control over line endings.

.editorconfig (1)

1-16: Solid EditorConfig Setup

The .editorconfig file establishes a consistent coding style across editors. It uses spaces, LF endings, UTF-8 encoding, trims trailing spaces, and ensures a final newline, which is great for maintaining consistency.

example/babel.config.js (1)

2-13: Sound Babel Configuration

The Babel config is clear and concise. Leveraging getConfig with preset values and integrating package metadata is done well.

example/.bundle/config (1)

1-2: Bundler Config is Clear

This configuration file clearly sets the bundle path and forces the Ruby platform for gem installations. It is straightforward and effective.

example/ios/.xcode.env (1)

1-11: Well-Documented Xcode Environment Setup

The .xcode.env file provides clear guidance on setting up the environment for Xcode script phases. The instructions and the use of export NODE_BINARY=$(command -v node) are clear and practical.

.yarnrc.yml (1)

1-11: Solid Yarn Configuration

The file sets essential Yarn options. The nodeLinker and nmHoistingLimits are clear, and the plugins and yarnPath definitions look correct.

.gitignore (1)

1-87: Comprehensive .gitignore

This file thoroughly ignores OS files, IDE settings, build artifacts, dependency directories, and generated files for multiple platforms. It’s well organized and helps keep the repository clean.

example/Gemfile (1)

1-6: Good Dependency Setup

The source and Ruby version constraints are clear and appropriate for the project’s needs.

tsconfig.json (1)

1-31: Solid TypeScript Configuration

This tsconfig.json enforces strict compiler options and clear module mapping, ensuring high code quality and maintainability.

.github/ISSUE_TEMPLATE/config.yml (1)

1-9: Well Configured Issue Template

The file disables blank issues and provides clear contact links for feature requests and discussions, improving community support.

CODE_OF_CONDUCT.md (1)

1-134: Comprehensive and Clear Code of Conduct
The document is well-structured and detailed. Ensure you update the placeholder ([INSERT CONTACT METHOD] on line 64) before merging.

🧰 Tools
🪛 LanguageTool

[style] ~33-~33: Try using a synonym here to strengthen your wording.
Context: ...ind * Trolling, insulting or derogatory comments, and personal or political attacks * Pu...

(COMMENT_REMARK)

.github/ISSUE_TEMPLATE/bug_report.yml (1)

1-69: Solid Bug Report Template
The template is clear and guides users to provide all essential details.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 64-64: trailing spaces

(trailing-spaces)

CONTRIBUTING.md (1)

1-123: Well-Structured Contribution Guide
This file clearly outlines the workflow, setup, and best practices for contributing. Nice work!

🧰 Tools
🪛 LanguageTool

[style] ~26-~26: Consider using a more polite wording.
Context: ...e a rebuild of the example app. If you want to use Android Studio or XCode to edit ...

(IF_YOU_WANT)


[uncategorized] ~73-~73: Loose punctuation mark.
Context: ...rg/en) for our commit messages: - fix: bug fixes, e.g. fix crash due to deprec...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~74-~74: Loose punctuation mark.
Context: ...crash due to deprecated method. - feat: new features, e.g. add new method to th...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~75-~75: Loose punctuation mark.
Context: ...d new method to the module. - refactor: code refactor, e.g. migrate from class ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~76-~76: Loose punctuation mark.
Context: ...from class components to hooks. - docs: changes into documentation, e.g. add us...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~76-~76: The preposition “to” seems more likely in this position than the preposition “into”.
Context: ... components to hooks. - docs: changes into documentation, e.g. add usage example f...

(AI_EN_LECTOR_REPLACEMENT_PREPOSITION_INTO_TO)


[uncategorized] ~76-~76: This verb may not be in the correct form. Consider using a different form for this context.
Context: ...docs: changes into documentation, e.g. add usage example for the module.. - test`...

(AI_EN_LECTOR_REPLACEMENT_VERB_FORM)


[typographical] ~76-~76: Two consecutive dots
Context: ...n, e.g. add usage example for the module.. - test: adding or updating tests, e.g...

(DOUBLE_PUNCTUATION)


[uncategorized] ~77-~77: Loose punctuation mark.
Context: ... usage example for the module.. - test: adding or updating tests, e.g. add inte...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~78-~78: Loose punctuation mark.
Context: ...integration tests using detox. - chore: tooling changes, e.g. change CI config....

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~104-~104: Loose punctuation mark.
Context: ...ious scripts for common tasks: - yarn: setup project by installing dependencie...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~105-~105: Loose punctuation mark.
Context: ...talling dependencies. - yarn typecheck: type-check files with TypeScript. - `ya...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~106-~106: Loose punctuation mark.
Context: ...eck files with TypeScript. - yarn lint: lint files with ESLint. - yarn test: ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~107-~107: Loose punctuation mark.
Context: ...: lint files with ESLint. - yarn test: run unit tests with Jest. - yarn examp...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~108-~108: Loose punctuation mark.
Context: ... tests with Jest. - yarn example start: start the Metro server for the example ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~109-~109: Loose punctuation mark.
Context: ...he example app. - yarn example android: run the example app on Android. - `yarn...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~110-~110: Loose punctuation mark.
Context: ...ple app on Android. - yarn example ios: run the example app on iOS. ### Sendin...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~114-~114: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...free series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead....

(EN_COMPOUND_ADJECTIVE_INTERNAL)

example/.watchmanconfig (1)

1-2: Valid Watchman Configuration
An empty JSON object is acceptable if no specific Watchman settings are required.

.watchmanconfig (1)

1-1: Watchman Config is Set
The file correctly contains an empty configuration object. No changes needed.

android/src/main/AndroidManifest.xml (1)

1-3: Solid Android Manifest Setup.
The manifest correctly defines the XML namespace and package name. It forms a good foundation for the Android project configuration.

tsconfig.build.json (1)

1-4: Clear and Concise TypeScript Build Config.
The configuration neatly extends the base tsconfig and excludes the specified directories. Double-check that excluding "lib" is intended for your build output.

example/ios/BleUtilsExample.xcworkspace/contents.xcworkspacedata (1)

1-11: iOS Workspace Configuration Looks Clean.
The workspace file correctly references the main Xcode projects and maintains a tidy structure.

example/android/app/src/main/res/values/strings.xml (1)

1-3: Android String Resource Defined Well.
The file properly sets the app name for localization and consistency throughout the app.

example/index.js (1)

1-5: React Native Entry Point is Correctly Configured.
The file registers the main App component with the AppRegistry using the correct app name. The implementation is clean and straightforward.

ios/BleUtils-Bridging-Header.h (1)

4-5: Imports look good

These imports are correct for making React Native's bridge module and view manager accessible to Swift code.

example/ios/BleUtilsExample/Images.xcassets/Contents.json (1)

1-6: Standard XCode asset catalog metadata

This is the correct format for an asset catalog metadata file. No issues found.

example/react-native.config.js (1)

4-21: Configuration looks good

Clean React Native config structure with:

  • Automatic CocoaPods installation
  • Proper dependency referencing
  • Explicit platform objects to prevent codegen failures

The comments explaining the platform specification are helpful.

example/ios/BleUtilsExample/Images.xcassets/AppIcon.appiconset/Contents.json (1)

1-52: Standard app icon configuration template

This is the correct format for an iOS app icon set configuration. Note that actual icon images will need to be added before app release.

example/android/app/src/main/res/values/styles.xml (1)

1-9: Well-structured Android theme configuration.

The Android theme is properly set up with the recommended parent theme for React Native apps. The EditText background customization addresses common styling issues in React Native Android apps.

example/metro.config.js (1)

2-18: Metro configuration is well-structured.

The configuration correctly uses builder-bob utilities to merge default settings with project-specific options. This approach maintains compatibility while allowing for customization.

example/README.md (1)

11-97: README provides comprehensive instructions.

The documentation covers all essential steps for setting up and running the example app on both platforms. The instructions are clear and include helpful details about CocoaPods dependencies for iOS.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~78-~78: Loose punctuation mark.
Context: ...run and modified your React Native App. 🥳 ### Now what? - If you ...

(UNLIKELY_OPENING_PUNCTUATION)


[style] ~82-~82: Consider using a more polite wording.
Context: ...partying_face: ### Now what? - If you want to add this new React Native code to an...

(IF_YOU_WANT)


[uncategorized] ~94-~94: Possible missing preposition found.
Context: ...an overview of React Native and how setup your environment. - [Learn the Basics](...

(AI_HYDRA_LEO_MISSING_TO)

🪛 markdownlint-cli2 (0.17.2)

73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


73-73: Inline HTML
Element: kbd

(MD033, no-inline-html)


74-74: Inline HTML
Element: kbd

(MD033, no-inline-html)

example/android/app/src/main/AndroidManifest.xml (1)

1-41: Manifest Setup Looks Solid!

The XML manifest is well structured. All required permissions and application settings are declared clearly. Great job on this new file!

README.md (1)

1-34: Overall, README.md Looks Great!

The installation, usage, contributing, and license sections are clear and helpful. Just address the small typo and extra blank lines for neatness.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

13-13: Multiple consecutive blank lines
Expected: 1; Actual: 2

(MD012, no-multiple-blanks)


22-22: Multiple consecutive blank lines
Expected: 1; Actual: 2

(MD012, no-multiple-blanks)

example/ios/BleUtilsExample/PrivacyInfo.xcprivacy (1)

1-38: Privacy Info File Structured Correctly!

The XML content is clear and properly organized. All privacy keys and arrays are set up as expected. Nice work!

lefthook.yml (1)

1-15: Lefthook Configuration Looks Good!

The pre-commit and commit-msg hooks are clearly defined. Everything is configured properly to enforce code quality.

example/android/app/src/debug/AndroidManifest.xml (1)

1-10: Debug Manifest Looks Good!

The debug configuration allows cleartext traffic as intended and leverages tool attributes correctly. The file is concise and correct.

example/android/gradle/wrapper/gradle-wrapper.properties (1)

1-8: Check Gradle Version Consistency.
The file looks well configured, but note the URL uses Gradle 8.12 while the summary mentioned 8.9. Verify that this version is intentional.

android/gradle.properties (1)

1-6: Properties File Looks Good.
All property values seem aligned with the project needs. Double-check that the minSdkVersion (24) meets your deployment targets.

example/ios/BleUtilsExample/LaunchScreen.storyboard (1)

1-47: Storyboard Setup Looks Clear.
The launch screen contains the expected UI elements and constraints. Verify the layout on various device sizes to ensure it meets design expectations.

.github/workflows/package-publish.yml (1)

1-20: Workflow Setup is Clean and Clear.
The steps are concise and easy to follow. Confirm that the custom setup action (.github/actions/setup) installs the required Node environment correctly.

turbo.json (1)

1-37: Turbo Configuration is Solid.
The pipeline tasks for building Android and iOS are defined clearly. Consider reviewing the outputs section if caching or artifact management is needed later on.

android/gradle/wrapper/gradle-wrapper.properties (1)

1-7: Gradle wrapper configuration looks good

The Gradle wrapper uses Gradle 8.9, which is recent. Settings follow best practices, including URL validation for security.

ios/BleUtils.mm (1)

1-18: Bridging implementation looks solid

The Objective-C bridging code properly exposes Bluetooth methods to JavaScript and correctly handles queue setup.

example/ios/Podfile (3)

1-15: Clean Podfile setup with proper React Native integration

The Podfile correctly resolves React Native dependencies and configures pod linkage. No issues in this section.

🧰 Tools
🪛 RuboCop (1.73)

[convention] 6-6: Put a comma after the last item of a multiline array.

(Style/TrailingCommaInArrayLiteral)


17-25: Target configuration looks good

Target is properly set up with native modules and React Native path configuration.


26-35: Post-install hook correctly implemented

Post-install configuration is properly set up for React Native integration.

The static analysis hint about trailing comma at line 31 is a false positive - trailing commas are good practice in Ruby when parameters are on separate lines, especially with commented parameters below.

🧰 Tools
🪛 RuboCop (1.73)

[convention] 31-31: Avoid comma after the last parameter of a method call.

(Style/TrailingCommaInArguments)

example/android/app/src/main/java/bleutils/example/MainActivity.kt (3)

1-7: Imports look good

All necessary React Native components are imported properly.


8-15: Main component name correctly specified

The MainActivity class correctly extends ReactActivity and specifies the main component name.


16-22: React Activity Delegate properly configured

The createReactActivityDelegate method is implemented correctly with proper New Architecture support.

example/ios/BleUtilsExample/AppDelegate.swift (3)

1-5: Required imports are present

All necessary frameworks for React Native iOS integration are imported.


6-17: Application setup looks correct

The AppDelegate properly sets up the module name and dependency provider.


23-30: Bundle URL handling looks good

The bundleURL method correctly handles both debug and release configurations.

example/src/App.tsx (4)

1-9: Imports look good

All necessary React Native and BLE components are imported.


15-24: BLE bond state listener setup is good

The effect hook properly sets up and cleans up the listener.


54-89: UI buttons setup looks good

Check state, get bonded peripherals, and scan buttons are implemented correctly.


130-153: Styles look good

Component styling is clean and organized with proper flexbox usage.

example/android/app/src/main/res/drawable/rn_edit_text_material.xml (1)

23-35: Good implementation of EditText fix

This correctly implements the fix for the known NullPointerException issue in React Native's EditText styling. The comments explain the problem clearly with helpful links.

src/type.ts (1)

5-29: Well-documented BLE state enum

The BleState enum is well-structured with clear platform-specific documentation and links to official references.

.github/workflows/lint.yml (3)

1-12: Workflow configuration looks solid.

The workflow triggers on the right events: pushes and pull requests to main branch, plus merge group checks. This ensures code quality at key points in the development workflow.


13-27: Lint job setup follows best practices.

The job runs on the latest Ubuntu, uses the standard checkout action, and leverages a reusable setup action. The lint and typecheck steps run as separate commands, which makes failures easier to diagnose.


29-40: Test job configuration is appropriate.

The test job follows the same pattern as the lint job for consistency. The --maxWorkers=2 flag prevents resource exhaustion in CI environments, and enabling coverage reporting provides valuable insights.

example/android/gradle.properties (5)

1-18: Good memory settings for Gradle.

The JVM memory settings provide enough headroom for building Android projects. The commented parallel option could be enabled to speed up builds on multi-core machines.


20-24: Correctly configured for AndroidX.

Setting android.useAndroidX=true ensures compatibility with modern Android libraries and components.


25-29: Good multi-architecture support.

Supporting multiple architectures (armeabi-v7a, arm64-v8a, x86, x86_64) ensures compatibility across different device types and emulators.


37-40: Hermes enabled by default.

Using Hermes as the JavaScript engine improves performance and reduces app size. This is the recommended setting for React Native apps.


30-36:

Details

❓ Verification inconclusive

New architecture enabled by default.

Setting newArchEnabled=true enables React Native's new architecture with TurboModules and Fabric renderer. This is forward-thinking but might introduce compatibility issues with some libraries.


🏁 Script executed:

#!/bin/bash
# Check if any dependencies might have issues with the new architecture
rg -i "new architecture|fabric|turbomodule" package.json

Length of output: 58


New Architecture Setting: Verify Dependencies

The newArchEnabled=true flag in example/android/gradle.properties enables React Native's new architecture (TurboModules and Fabric). This forward-looking setup may lead to compatibility issues with certain libraries. The initial search in package.json didn’t reveal any related references. However, this check was limited. Please verify manually across the repository to ensure no dependency conflicts exist.

  • Confirm if any part of the codebase references TurboModules, Fabric, or uses the new architecture flag.
  • If issues arise, consider updating or testing affected libraries.
android/gradlew (6)

1-66: Standard Gradle wrapper script with comprehensive documentation.

The script includes thorough documentation about its purpose, requirements, and limitations. These comments help developers understand how to use and modify the script.


67-90: Robust directory resolution logic.

The script correctly resolves symbolic links and determines the application's home directory. It handles edge cases well and includes proper error handling.


91-104: Good error handling with clear messages.

The script defines helper functions for warnings and errors that provide clear feedback to users when something goes wrong.


105-144: Comprehensive OS detection and Java path resolution.

The script handles different operating systems appropriately and finds the Java executable reliably. It provides helpful error messages when Java is not found.


145-201: Proper file descriptor and path handling.

The script manages file descriptor limits correctly and handles path conversions for Windows environments. It's well-prepared for cross-platform use.


202-253: Safe handling of JVM options.

The script processes JVM options securely, avoiding common shell injection vulnerabilities. It requires xargs availability and properly escapes special characters.

example/android/gradlew (1)

1-252: Identical to the root gradlew script.

This script is identical to the one in the android/ directory. Having this copy in the example directory is standard practice for Android projects with example apps.

example/android/gradlew.bat (1)

1-94: Standard Gradle wrapper script looks good

This is a standard Gradle wrapper batch script generated by Gradle. It contains proper error handling for Java detection and follows best practices for Windows batch scripts.

android/gradlew.bat (1)

1-94: Standard Gradle wrapper script looks good

This is a standard Gradle wrapper batch script generated by Gradle. It contains proper error handling for Java detection and follows best practices for Windows batch scripts.

.github/actions/setup/action.yml (1)

17-23: Good caching strategy

The cache paths and key structure follow best practices. The fallback restore keys provide a good balance between specificity and cache reuse.

example/ios/BleUtilsExample.xcodeproj/xcshareddata/xcschemes/BleUtilsExample.xcscheme (1)

1-88: Standard Xcode scheme file looks good

This is a well-configured Xcode scheme file with appropriate build, test, launch, profile, analyze, and archive settings for iOS development.

example/android/app/build.gradle (1)

82-87: Verify applicationId matches your package name

Ensure the applicationId "bleutils.example" correctly matches your package naming scheme for proper app identification in the Play Store.

example/ios/BleUtilsExample.xcodeproj/project.pbxproj (2)

265-266: Note the hardcoded development team ID

The debug configuration contains a hardcoded development team ID (36YZKGR6QU). You may need to update this for your team.


268-269:

Details

✅ Verification successful

Consider iOS compatibility range

The deployment target is iOS 15.1, which excludes older devices. Verify this meets your target audience requirements.


🏁 Script executed:

#!/bin/bash
# Check iOS version market share to determine if 15.1 is appropriate
curl -s "https://gs.statcounter.com/ios-version-market-share" | grep -A 10 "iOS Version Market Share"

Length of output: 53614


iOS Deployment Target Review

The deployment target remains set to iOS 15.1 as shown in file
example/ios/BleUtilsExample.xcodeproj/project.pbxproj (lines 268–269).

Based on the Statcounter data from March 2025, most active devices are on iOS 17 and later (with iOS 18.3 at 58.58% and iOS 18.1 at 6.33%). This suggests that using 15.1 as the minimum should cover the vast majority of users. However, if your target audience includes markets where older iOS versions might still be in use, please double-check your audience metrics.

example/android/app/src/main/java/bleutils/example/MainApplication.kt (4)

1-14: LGTM: Imports follow best practices

The imports provide all required dependencies for a standard React Native Android application.


15-31: Well-structured React Native host implementation

The ReactNativeHost implementation correctly overrides all required methods and follows React Native best practices.


33-34: Properly implemented reactHost property

This follows the standard pattern for implementing ReactHost in React Native applications.


36-43: Correct initialization in onCreate

The onCreate method properly initializes SoLoader and conditionally loads the new architecture entry point.

example/package.json (5)

1-4: LGTM: Project metadata is well-defined

The package name, version, and privacy settings are appropriate for an example application.


5-11: Build scripts use specific optimization flags

The build scripts include detailed configuration parameters that optimize the build process for development environments.


12-16: Using recent React and React Native versions

The project uses React 19.0.0 and React Native 0.78.0, which are recent versions with modern features.


17-28: Development dependencies are up-to-date

All development tools have appropriate versions for the current React Native ecosystem.


29-31: Node requirement is appropriate

Node.js 18+ is appropriate for modern React Native development.

ios/Helper.swift (5)

4-22: Well-structured Bluetooth state handling

The Helper class correctly maps CBManagerState enum values to human-readable strings, including the @unknown default case for future compatibility.


24-46: Good advertisement data reformatting

The method effectively normalizes CoreBluetooth advertisement data keys to JavaScript-friendly format.


48-62: Solid peripheral representation class

The Peripheral class properly encapsulates CBPeripheral with additional metadata for RSSI and advertisement data.


75-82: Proper Hashable implementation

The class correctly implements Hashable protocol using the peripheral's UUID for equality and hashing.


84-88: Useful extension method

The extension provides a convenient way to access peripheral UUIDs as strings.

package.json (6)

10-28: LGTM: Proper file inclusions/exclusions

The file filters properly include source code while excluding build artifacts and test files.


29-37: LGTM: Complete build scripts

All necessary scripts for development, testing, and publishing are included.


38-117: LGTM: Comprehensive package metadata

The package includes complete metadata, version control settings, and release configuration.


118-148: LGTM: Consistent code style configuration

ESLint and Prettier settings provide consistent code formatting rules.


149-178: LGTM: Build output configuration

React Native Builder Bob is correctly configured for multiple output formats.


6-9:

Details

❓ Verification inconclusive

Check entry point file extension consistency

The source is specified as index.tsx while react-native entry point is index.ts. Ensure these are intentionally different file types.


🏁 Script executed:

#!/bin/bash
# Check if both files exist and their contents
ls -la src/index.tsx src/index.ts 2>/dev/null || echo "One or both files don't exist"

# If they both exist, check if they're identical or different
if [ -f src/index.tsx ] && [ -f src/index.ts ]; then
  diff -s src/index.tsx src/index.ts
fi

Length of output: 196


Entry Point File Extension Check

Our verification shows that only the file src/index.ts exists. The expected src/index.tsx is missing. Please confirm whether using a .ts file for the React Native entry point is intentional. If you meant to provide a TSX file (for JSX support), update the entry point or add the missing file.

@ByteZhang1024 ByteZhang1024 merged commit d44e2e6 into main Apr 9, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants